package cn.kgc.chlm.servlet;

import cn.kgc.chlm.entity.Menu;
import cn.kgc.chlm.service.MenuService;
import cn.kgc.chlm.service.impl.MenuServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/menu/*")
public class MenuServlet extends BaseServlet {

    public void menu_info(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        MenuService menuService = new MenuServiceImpl();
        List<Menu> menuList = menuService.selectMenuALl();

        //将获取到的菜单集合存入Request
        req.setAttribute("menus",menuList);
        req.getRequestDispatcher("/WEB-INF/pages/menu.jsp").forward(req,resp);
    }
}
